 
	
angular.module("app")
.controller('lineBarCtrl',['$scope',function ($scope){
		
		var xAxis=['周一','周二','周三','周四','周五','周六','周日'];

        var data=[{name:"调出店铺销售",data:[10, 12, 21, 54, 260, 830, 710]},
            {name:"调入店铺销售",data:[30, 182, 434, 791, 390, 30, 10]},
            {name:"区域销售",data:[1320, 1132, 601, 234, 120, 90, 20]}];

        var newdata={name:"测试数据",data:[120,932, 601, 734, 120, 90, 60]};

        $scope.colors = ['#5793f3', '#d14a61', '#675bba','red'];
        //初始化X轴
        $scope.xdata=xAxis;
        //初始化图表数据
        $scope.lineData=angular.copy(data);
        $scope.barData=angular.copy(data);
        $scope.lineBarData=angular.copy(data);
        //初始化图表类型
        $scope.chartType='line';

        //添加数据
        $scope.add=function () {
            $scope.lineData.push(newdata);
        };
        //重置数据
        $scope.reset=function () {
            $scope.chartType='line'
            $scope.lineData=angular.copy(data);
        }
        //清除数据
        $scope.clear=function () {
            $scope.lineData =[];
        }
        
        $scope.changeToLine=function () {
            $scope.chartType='line';
            $scope.lineData=angular.copy(data);
        }

        $scope.changeToBar=function () {
            $scope.chartType='bar';
            $scope.lineData=angular.copy(data);
        }

        $scope.changeToLineBar=function () {
            $scope.chartType='line-bar';
            $scope.lineData=angular.copy(data);
        }
		
	}]);
 